package com.douyin.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.douyin.entity.Comments;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.douyin.vo.CommentVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 视频评论表 Mapper 接口
 * </p>
 *
 * @author k
 * @since 2025-07-27
 */
public interface CommentsMapper extends BaseMapper<Comments> {
    /**
     * 【新】分页查询顶级评论
     */
    IPage<CommentVO> findRootCommentsPage(IPage<CommentVO> page, @Param("videoId") Long videoId, @Param("currentUserId") Long currentUserId);

//    /**
//     * 【新】查询一批顶级评论的少量回复作为预览
//     */
//    List<CommentVO> findRepliesPreview(@Param("rootCommentIds") List<Long> rootCommentIds);

    List<CommentVO> findAllDescendants(@Param("videoId") Long videoId,@Param("initialParentId") Long initialParentId,@Param("currentUserId") Long currentUserId);

    List<CommentVO> findCommentsByVideoId(@Param("videoId") Long videoId,@Param("currentUserId") Long currentUserId);
}
